<template class="index_background">
  <div>
    <el-collapse>
      <div class="divcss5" style="border-bottom:3px solid #eee">
      <h5 align="left">职位信息管理>职位信息</h5>
        <div align="left" style="position:relative;top:40px">
          <router-link to='jobPublish'>
          <el-button size="small" type="primary">发布职位</el-button>
          </router-link>
        </div>
      </div>
    
        <el-table :data="tableData">
        <el-table-column prop="jid" label="职位信息编号" width="120" align="center">
        </el-table-column>
        <el-table-column prop="name" label="职位名称" width="100" align="center">
        </el-table-column>
        <el-table-column prop="hc" label="职位HC" width="100" align="center">
        </el-table-column>
        <el-table-column prop="time" label="发布时间" width="100" align="center">
        </el-table-column>
        <el-table-column prop="status" label="状态" width="100" align="center">
        </el-table-column>
        <el-table-column label="操作" width="300" align="center">
      <template slot-scope="scope" >
        <el-button
          size="mini"
          @click="handleLook(scope.$index, scope.row)">置顶</el-button>
        <el-button
          size="mini"
          @click="handleLook(scope.$index, scope.row)">修改</el-button>
        <el-button
          size="mini"
          type="danger"
          @click="handleDelete(scope.$index, scope.row)">删除</el-button>
      </template>
    </el-table-column>
    </el-table>
    </el-collapse>
    <el-pagination v-if="total"
      background
      layout="prev, pager, next"
      :total="total">
    </el-pagination>
    </div>
</template>

<style>
.divcss5{
  margin:30px 0;
  color: rgb(144,144,144);
  height: 100px;
}
.index_background{
   background:white;
   }
  .lable{
    color: rgb(144,144,144);
    margin-top:30px;
    margin-bottom:30px;
  }
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }
  
  .el-aside {
    color: #333;
  }
</style>

<script>
import fetch from "../api/fetch";
  export default {
    data() {
      return {
        total: 0,
        tableData: [],
      }
    },
    async mounted() {
      const result = await fetch.getJobList({
        eid: '1006'
      })
      if (result.status === 200) {
        this.tableData = result.data.rows;
        this.total = result.data.total;
      }
    },
     methods: {   
      handleLook(index, row) {
        console.log(index, row);
      },
      handleDelete(index, row) {
               this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          fetch
          .jobRemove(100601)
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });
      }
    }
  };
</script>